package StructuralMode.combination.safeMode;

/*
*   节点组件
* */
public abstract class NodeComponent {

      public String name;
      public Integer level;

      public NodeComponent(String name, Integer level) {
            this.name = name;
            this.level = level;
      }

      // 添加子节点
      public NodeComponent add(NodeComponent nodeComponent){
          throw new UnsupportedOperationException();
      }

      // 删除子节点
      public void del(NodeComponent nodeComponent){
            throw new UnsupportedOperationException();
      }

      // 获取当前节点名称
      public String getName(){
          return name;
      }
      // 打印名称
      public void print(){
            String k = new String();
            String j = new String("--");
            for (int i = 0; i < level; i++) {
                 k+=j;
            }
            System.out.println(k+this.name);
      }

}
